package ex106;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        MyInteger myInteger = new MyInteger();
        Scanner scanner = new Scanner(System.in);

        System.out.print("输入一个正整数: ");
        int n = scanner.nextInt();

        if (n <= 0) {
            System.out.println("不正确的输入");
        } else {
            System.out.println(myInteger.toHexString(n, false));
        }

        System.out.println("本程序也可以转换负整数，以无符号数处理！");
        System.out.print("输入一个负整数: ");
        n = scanner.nextInt();

        System.out.println("16进制: " + myInteger.toHexString(n, false));
        System.out.println(" 8进制: " + myInteger.toOctString(n, false));
        System.out.println(" 2进制: " + myInteger.toBinString(n, false));

    }
}
